<?php

namespace Diablo7\HyperfPulsar\Message;

use Diablo7\HyperfPulsar\Exception\SerializeException;
use Hyperf\Contract\ContainerInterface;

abstract class AbstractMessage implements MessageInterface
{
    /**
     * @var ContainerInterface
     */
    public $container;

    public $endpoint = "default";

    public $tenant = "default";

    public $namespace = "default";

    public $topic = "default";

    /**
     * 返回查询参数
     * @return array
     */
    abstract public function getQueryParams() :array;

    public function getEndpoint() :string
    {
        return $this->endpoint;
    }

    public function getTenant() :string
    {
        return $this->tenant;
    }

    public function getNamespace() :string
    {
        return $this->namespace;
    }

    public function getTopic() :string
    {
        return $this->topic;
    }

    public function serialize() :string
    {
        throw new SerializeException("消息不支持序列化");
    }
    public function unserialize(string $data) :string
    {
        throw new SerializeException("消息不支持反序列化");
    }
}